public class test12 {
    public static void main(String[] args) {
        long sum = 0;
        for (int i = 1 ; i <= 2019 ; i++){
            int a = i;
            while (a!=0){
                int b = a % 10;
                if (b == 1 || b == 0 || b == 2 || b == 9){
                    sum += i;
                    break;
                }
                a = a/10;
            }

        }
        System.out.println(sum);
    }
}
